load("//bazel:tachyon.bzl", "if_gpu_is_configured")
load(
    "//bazel:tachyon_cc.bzl",
    "tachyon_cc_library",
    "tachyon_cc_unittest",
    "tachyon_cuda_test",
)

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
    name = "points",
    hdrs = [
        "affine_point.h",
        "affine_point_impl.h",
        "jacobian_point.h",
        "jacobian_point_impl.h",
        "point_xyzz.h",
        "point_xyzz_impl.h",
        "projective_point.h",
        "projective_point_impl.h",
    ],
    deps = [
        "//tachyon/base:parallelize",
        "//tachyon/base/buffer:copyable",
        "//tachyon/base/containers:container_util",
        "//tachyon/base/json",
        "//tachyon/math/base:groups",
        "//tachyon/math/elliptic_curves:semigroups",
        "//tachyon/math/geometry:affine_point",
        "//tachyon/math/geometry:curve_type",
        "//tachyon/math/geometry:jacobian_point",
        "//tachyon/math/geometry:point2",
        "//tachyon/math/geometry:point3",
        "//tachyon/math/geometry:point4",
        "//tachyon/math/geometry:point_xyzz",
        "//tachyon/math/geometry:projective_point",
    ],
)

tachyon_cc_library(
    name = "sw_curve",
    srcs = ["sw_curve.h"],
    deps = [
        ":sw_curve_traits_forward",
        "//tachyon/math/geometry:affine_point",
        "//tachyon/math/geometry:curve_type",
        "//tachyon/math/geometry:jacobian_point",
        "//tachyon/math/geometry:point_conversions",
        "//tachyon/math/geometry:projective_point",
        "@com_google_absl//absl/base",
    ],
)

tachyon_cc_library(
    name = "sw_curve_traits_forward",
    srcs = ["sw_curve_traits_forward.h"],
)

tachyon_cc_unittest(
    name = "short_weierstrass_unittests",
    srcs = [
        "affine_point_unittest.cc",
        "jacobian_point_unittest.cc",
        "point_xyzz_unittest.cc",
        "projective_point_unittest.cc",
    ],
    deps = [
        ":points",
        "//tachyon/base/buffer:vector_buffer",
        "//tachyon/base/json",
        "//tachyon/math/elliptic_curves/short_weierstrass/test:sw_curve_config",
        "//tachyon/math/elliptic_curves/test:random",
    ],
)

tachyon_cuda_test(
    name = "short_weierstrass_correctness_gpu_tests",
    size = "small",
    srcs = if_gpu_is_configured([
        "affine_point_correctness_gpu_test.cc",
        "non_affine_point_correctness_gpu_test.cc",
    ]),
    deps = [
        "//tachyon/device/gpu:gpu_memory",
        "//tachyon/math/elliptic_curves/bn/bn254:g1_gpu",
        "//tachyon/math/elliptic_curves/short_weierstrass/kernels:elliptic_curve_ops",
        "//tachyon/math/test:launch_op_macros",
    ],
)
